<?php

namespace App\Console\Commands\Demo;

use GuzzleHttp\Client;
use Illuminate\Console\Command;

class HttpClientCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'demo:http-client';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $client = new Client();
        $url = 'https://jisuapidream.api.bdymkt.com/dream/search?keyword=拉屎&pagenum=1&pagesize=10';
        $response = $client->get($url, [
            'headers' => [
                'X-Bce-Signature' => 'AppCode/e03352d13d354058b75858ed8728c9c3'
            ]
        ]);

        var_dump($response->getBody()->getContents());

        return 0;
    }
}
